package threshold;

import java.util.Scanner;

/**
 * @Author wujiaming
 * @Description TODO
 * @Date 2023-03-14 16:31
 * @Version 1.0
 */
public class MaxNum {

    public void maxNum(int[] nums){
        int max = nums[0],min=nums[0];
        for (int i = 0; i <nums.length ; i++) {
            if(nums[i]>max){
                max=nums[i];
            }
            if(nums[i]<min){
                min = nums[i];
            }
        }
        System.out.println(max +" "+min);
    }
    public static void main(String[] args) {
        MaxNum test = new MaxNum();
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int N = sc.nextInt();
            int[] nums = new int[N];
            for (int i = 0; i <N ; i++) {
                nums[i] = sc.nextInt();
            }
            test.maxNum(nums);
        }

    }
}
